<template>
  <div style="background: #fff">
    <div class="title">
      <div>{{title}}</div>
    </div>
    <div style="padding: 1.875rem">
      <el-form :inline="true">
          <!-- <el-button type="danger" @click="showInvest" v-if="admin_type==3">账户充值</el-button>
           <el-button type="success" @click="cash">提现</el-button> -->
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="data" stripe style="width: 100%; margin-bottom: 1.875rem">
     
          
    
       
    </el-table>
    
   
   
  </div>
</template>

<script>
import mixin from "../../js/mixin";

export default {
  name: "homePage",
  mixins: [mixin],
  data() {
    return {
      is_check:false,
      investModal:false,
      api_url: "account",
      code_url:'',
      total_price:0,
      h_price:0,
      p_price:0,
      item: {},
      pay_code:'',
    };
  },
  components: {},
  mounted() {
  
  },
  created() {
     this.admin_type = localStorage.getItem('admin_type')
    this.title = this.$route.meta.title
    this.init()
    
  },
  methods: {
    getItem() {
      this.global.httpRequest(this.api_url, { is_self: true }).then((res) => {
        this.data = [res];

      });
    },
    

    init(){
      // this.getCate()
      this.getItem()
      if(this.admin_type==3){
         this.getInvestPrice()
      }
     
    },
    cash(){
        this.$message({
        type: 'error',
        message: '即将开放'
      })
    },
     showInvest(){
      if(this.total_price==0){
         this.$message({
        type: 'error',
        message: '账户金额充足，无需充值'
      })
      return
      }
      this.investModal = true
      this.code_url = ''
    },
    getInvestPrice(){
        this.global.httpRequest('order/investPrice',{},'post',false).then((res) => {
         let {code,data} = res
          if(code==0){
            this.total_price = data.total_price
             this.h_price = data.h_price
              this.p_price = data.p_price
          }
      });
    },
    invest(){
        this.global.httpRequest('order/invest',{total_price:this.total_price,h_price:this.h_price,p_price:this.p_price},'post',false).then((res) => {
         let {code,data} = res
          if(code==0){
            
            this.investPay(data.id)
          }
      });
    },

    investPay(e){
        this.global.httpRequest('order/investPay',{id:e},'post',false).then((res) => {
         let {code,data} = res
          if(code==0){
            this.pay_code =data
          }
      });
    },
   
  },
};
</script>

<style scoped>



.contents {
  padding: 1.875rem;
  display: flex;
  flex-wrap: wrap;
}

.dateTitle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
}
.dateInfo {
  width: 18.5%;
  text-align: center;
  background: #fff;
  color: #6f737a;
  line-height: 3.75rem;
  cursor: pointer;
}
.saleDate {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
}
.saleDate > div {
  width: 48.5%;
  padding: 2.5rem 0;
  background: #fff;
}
.saleDate > div > span {
  display: block;
  margin-left: 1.875rem;
  color: #6f737a;
  margin-bottom: 1.5rem;
}
.saleDate > div > div {
  margin-left: 1.875rem;
  color: #333;
  font-size: 1.5rem;
}

.goodsInfo {
  width: 13.5rem;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
}
.goodsInfo > div {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.revenueInfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.revenueInfo > span {
  color: #6f737a;
  margin-bottom: 1.5rem;
}
.revenueInfo > div {
  color: #333;
  font-size: 2rem;
}
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.titleInfo{
  display: flex;
  align-items: center;
  margin: 2rem 5rem;
  margin-left: 2rem;
}

.payCode{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
</style>
